<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta name="renderer" content="webkit"/>
  <meta name="force-rendering" content="webkit"/>
  <!-- import CSS -->
  <link rel="stylesheet" href="../js/3rd/elementUi/index.css">
  <link rel="stylesheet" href="../css/pc.css">
  <script src="../js/3rd/elementUi/vue.js"></script>
  <script src="../js/3rd/jquery-3.1.1.min.js"></script>
</head>
<body>
  <div id="userLists" class="user-lists" style="display:none">
    
	<el-container>
	  <el-aside class="sider-bar" id="siderbar">
      <div class="logo"><img src="../image/logo.jpg">来赚吧管理后台</div> 
	    <tp-siderbar title="发布项目"></tp-siderbar>
	  </el-aside>
    <el-main>
	  <div class="right-content">
      <el-breadcrumb separator-class="el-icon-arrow-right" class="bread-bd">
        <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>股东申请列表</el-breadcrumb-item>
      </el-breadcrumb>
  
      <template>
        <el-table
          :data="applyList"
          stripe
          style="width: 100%">
          <el-table-column
            prop="id"
            label="编号"
            width="180">
          </el-table-column>
          <el-table-column
            prop="name"
            label="姓名"
            width="180">
          </el-table-column>
          <el-table-column
            prop="createTime"
            label="注册时间">
          </el-table-column>
          <el-table-column
            prop="stockNumber"
            label="申购份数">      
          </el-table-column>
          <el-table-column
            prop="images"
            header-align="center"
            align="center"
            width="150px"
            label="图片">
            <template slot-scope="scope">
             <el-popover
              placement="right"
              title=""
              trigger="hover">
              <img :src="scope.row.images"/>
              <img slot="reference" :src="scope.row.images" :alt="scope.row.images" style="max-height: 50px;max-width: 130px">
             </el-popover>
            </template>
          </el-table-column>
          <!-- <el-table-column            
            label="图片"
            width="100">
            <template slot-scope="scope">
              <el-button @click="lookImage(scope.$index,scope.row)" type="text" size="small" v-if="scope.row.images">查看</el-button>
              <el-button v-else type="text" size="small" >无</el-button>
            </template>
          </el-table-column> -->
          <!-- <el-table-column
            prop="images"
            label="图片">

          </el-table-column> -->
          <el-table-column fixed="right" label="操作">
           <template slot-scope="scope">
              <el-button
                size="mini"
                @click="handleCheckCrowFunding(scope.$index, scope.row)">审核</el-button>              
            </template>
          </el-table-column>  
        </el-table>
      </template>

       
      <el-pagination
        :page-size="20"

        layout="prev, pager, next"
        @current-change="handleCurrentChange"
        :total="totalCount">
      </el-pagination>
      <div class="clearfix"></div>
    </div>  
   </el-main>  
	</el-container>
  <el-dialog title="更新众筹状态" :visible.sync="dialogFormVisible">
    <el-form >
      <el-form-item label="操作" :label-width="formLabelWidth">
        <el-select v-model="selectStatusVal" placeholder="请选择目前操作">
          <el-option label="通过" value="2"></el-option>
          <el-option label="删除" value="1"></el-option>    
        </el-select>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="dialogFormVisible = false">取 消</el-button>
      <el-button type="primary" @click="submitAuditPass()">确 定</el-button>
    </div>
  </el-dialog>


</body>


  <!-- import JavaScript -->
  <script src="../js/3rd/elementUi/index.js"></script>
  <script src="../js/js/admin_siderbar.js"></script>
  <script src="../js/js/common.js"></script>
  <script>
   var token=getCookie("userToken");
   var userId=getCookie("userId");
   if(!token||!userId){
      window.location.href = "/admin/login.html";
   }
  

    new Vue({
      el: '#userLists',
      data: {
        applyList:[],
        telephoneNum:'',
        currentTab:null,
        totalCount:null,
        activeName: 'first',
        page:1,
        selectRowContent:'',
        dialogFormVisible:false,
        selectStatusVal:'',
        isDoingCrowFundingSubmitHandle:false,
        selectIndex:null,
        formLabelWidth: '120px',
        lookImageDialogVisible:false,
        currentImageUrl:''
      },
      created:function(){
         var getUsersUrl="/stockApply/getStockApplyList ";
         var data={
                   page: 1,
                   size: 20,
                   status: 0,
                   token: token,
                   userId: parseInt(userId),
                   client: 3,
         }
         pushData(getUsersUrl,data,function(res){
             console.log(res)
             if(res.errorCode=="008"){
               window.location.href = "/admin/login.html";
             }
             this.applyList=res.data.stockApplyList;
             this.totalCount=res.data.totalCount;     
             this.filterApplyList();
         }.bind(this));
         $("#userLists").show();
      },
      methods:{
            lookImage:function(index,row){
                this.lookImageDialogVisible=true;
                this.currentImageUrl=row.images;
            },
            handleCurrentChange:function(val){
               console.log(val);
               var getUsersUrl="/user/getUsers";
               this.page=val;
               var data={
                         category:this.currentTab,
                         page: val,
                         size: 20,
                         telephone: this.telephoneNum,
                         token: token,
                         userId: parseInt(userId),
                         client: 3,
               }
               //console.log(data)
               pushData(getUsersUrl,data,function(res){
                   console.log(res)
                   this.applyList=res.data.user;
                   this.totalCount=res.data.totalCount;
                   this.filterApplyList();
               }.bind(this))
            },
            searchByTelephone:function(){
               var getUsersUrl="/user/getUsers";
               var data={
                         category:this.currentTab,
                         page: this.page,
                         size: 20,
                         telephone: this.telephoneNum,
                         token: token,
                         userId: parseInt(userId),
                         client: 3,
               }
               console.log(data)
               pushData(getUsersUrl,data,function(res){
                   console.log(res)
                   this.applyList=res.data.user;
                   this.totalCount=res.data.totalCount;
                   this.filterApplyList();
               }.bind(this))
            },
            filterApplyList:function(){
              for(var i=0;i<this.applyList.length;i++){
                     this.applyList[i].createTime=formatDate(this.applyList[i].createTime)            
                   }
            },
            handleCheckCrowFunding:function(index,row){
              this.dialogFormVisible=true;
              this.selectRowContent=row;
              this.selectIndex=index;              
            },
            submitAuditPass:function(){
              if(this.isDoingCrowFundingSubmitHandle){
                return ;
              }
              this.isDoingCrowFundingSubmitHandle=true;
   
              var data={
                client: 3,
                  id: parseInt(this.selectRowContent.id),
                  status:this.selectStatusVal,
                  token: token,
                  userId: parseInt(userId)
              }
              var url="/stockApply/updateStockApplyStatus";
              pushData(url,data,function(res){
                this.isDoingCrowFundingSubmitHandle=false;
                if(res.state){               
                    this.applyList.splice(this.selectIndex,1);
                  this.dialogFormVisible=false;
                }else{
                  alert(res.message)
                }
              }.bind(this))
            },
             

        }

      
    })
  </script>
</html>